﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Entity;
using BusinessObject;

namespace GreenLife.Admin
{
    public partial class ChinhSuaLinkWeb : System.Web.UI.Page
    {
        DataSet ds;
        LinkWeb lw;
        LinkWebBO lwBO = new LinkWebBO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                selectLinkWebById();
            }
        }

        public void selectLinkWebById()
        {
            lw = new LinkWeb();
            int id = Int32.Parse(Request.QueryString["id"]);
            lw = lwBO.selectLinkWebById(id);

            txtID.Text = lw.LinkWebID.ToString();
            txtName.Text = lw.LinkWebName.ToString();
            txtSite.Text = lw.LinkWebSite.ToString();
        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            lw = new LinkWeb();
            lw.LinkWebID= Int32.Parse(txtID.Text);
            lw.LinkWebName = txtName.Text;
            lw.LinkWebSite = txtSite.Text;
            if (lwBO.updateLinkWeb(lw))
            {
                Response.Redirect("DanhSachLinkWeb.aspx");
            }
        }
    }
}